var app = getApp();
var util = require("../../utils/libs.js")
var api = require("../../utils/api.js")
Page({
  data: {
    id:null,
    uid:null,
    content:""
  },
  onLoad (options) {
    let that = this
    var uid = wx.getStorageSync('uid');
   that.setData({
     id:options.id,
     uid:uid
   })
    // 页面初始化 options为页面跳转所带来的参数
  },
  getcontent(e){
    let that = this
    let content = e.detail.value
    that.setData({
      content:content
    })
  },
  handleSubmit(){
    let that = this
    var id = that.data.id
    util.request(api.addComment, {
    id:that.data.id,
    uid:that.data.uid,
    content:that.data.content
    }, "POST")
    .then(function (res) {
      if (res.error_code === 0) {
       
         wx.showToast({
           title:"发布成功",
           icon: 'success',
           duration: 2000,
           success:function(){
             wx.navigateTo({
               url:"/pages/assist/assist?id="+id
             })
           }
         })
      }
    })
  }
})
